// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import Vant from 'vant';
import store from './store'
import 'vant/lib/index.css';
import './libs/rem.js';
import Cookies from 'js-cookie'
import VueWechatTitle from 'vue-wechat-title'
import axios from 'axios'
import { post, fetch, patch, put, uploadImage } from './common/https';
import vueFilter from '@/common/filter'
import vueTouch from 'kim-vue-touch'
import VideoPlayer from 'vue-video-player'
// import VueLazyLoad from 'vue-lazyload'

import Calendar from 'vue-mobile-calendar'
Vue.use(Calendar);

import echarts from 'echarts'
Vue.prototype.$echarts = echarts

require('@/mock')
require('video.js/dist/video-js.css')
require('vue-video-player/src/custom-theme.css')
// require('videojs-contrib-hls/dist/videojs-contrib-hls');
// Vue.use(VueLazyLoad, {
//   error: './static/icon/comon/error.png',
//   loading: './static/icon/comon/loading.png'
// })
Vue.use(VideoPlayer);
Vue.use(vueTouch)
Vue.use(Vant);
Vue.use(VueWechatTitle)

//appId
Vue.prototype.APPID = 'wxd90cdac09f5158be'

//公用过滤
for (let key in vueFilter) {
  Vue.filter(key, vueFilter[key])
}

// 定义全局Cookie
Vue.prototype.$cookies = Cookies

export const search = (variable) => {
  var arrStr = window.location.search.substring(1).split("&");
  for (var i = 0; i < arrStr.length; i++) {
    var temp = arrStr[i].split("=");
    if (temp[0] === variable){
        return decodeURIComponent(temp[1]);
    }  
  }
  return "zh_cn"
}

Vue.prototype.$search = search;

//定义全局请求变量
Vue.prototype.$http = axios;
Vue.prototype.$post = post;
Vue.prototype.$fetch = fetch;
Vue.prototype.$patch = patch;
Vue.prototype.$put = put;
Vue.prototype.$uploadImage = uploadImage;


Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  store,
  router,
  components: { App },
  template: '<App/>'
})
